package other;

public class fib {
    public int fib(int n) {
        int pre_1=1,pre_2=0;
        if(n==0)return pre_1;
        if(n==1)return pre_2;
        int result=0;
        for(int i=2;i<=n;i++){
            result = pre_1+pre_2;
            pre_2 = pre_1;
            pre_1 = result;
        }
        return result;
    }

    public static void main(String[] args) {
        System.out.println(new fib().fib(3));
    }
}
